import request from 'utils/request'

// 会员注册
export function register(model) {
  return request({
    url: '/Member/Register',
    method: 'post',
    data: {
      UserName: model.userName.value, // 账号 手机号
      Password: model.password.value, // 密码
      GradeId: model.carrer.GradeId, // 会员自选等级
      SmsCode: model.sms.value, // 短信验证码
      InvitUser: model.referrer.value, // 推荐人编号
      JoinSourceId: model.joinSourceId.value // 注册来源 0-H5注册
    }
  })
}

// 会员登录
export function login(model) {
  return request({
    url: '/Member/Login',
    url: 'https://banzan.hsy884.com/api/user/MobileLogin',
    // url: '/m/user/login',
    method: 'post',
    data: {
      UserName: model.userName.value, // 账号手机号
      UserPwd: model.password.value // 密码
      // LoginType: 1
    }
  })
}

// 会员短信验证码登录
export function smsLogin(model) {
  return request({
    url: '/Member/SmsLogin',
    method: 'post',
    data: {
      UserName: model.userName.value, // 手机号
      SmsCode: model.sms.value // 短信验证码
    }
  })
}

// 修改密码
export function modifyPassword(model) {
  return request({
    url: '/Member/ModifyPassword',
    method: 'post',
    data: {
      OldPwd: model.oldPwd.value, // 旧密码
      NewPwd: model.newPwd.value, // 新密码
      UserId: ''
    }
  })
}

// 找回密码
export function forgetPwd(model) {
  return request({
    url: '/Member/ForgetPwd',
    method: 'post',
    data: {
      UserName: model.userName.value, // 账号 手机号
      SmsCode: model.sms.value, // 短信验证码
      UserPwd: model.password.value, // 用户密码
      ConfirmPwd: model.surePassword.value // 确认密码
    }
  })
}

// 获取个人信息
export function getMemberInfo() {
  return request({
    url: '/Member/GetMemberInfo',
    method: 'post'
  })
}

// 检查会员卡
export function CheckApplyMemberCard() {
  return request({
    url: '/Member/CheckApplyMemberCard',
    method: 'post'
  })
}

// 修改个人信息
export function updateMemberInfo(model) {
  return request({
    url: '/Member/UpdateMemberInfo',
    method: 'post',
    data: {
      UserName: model.phone.value, // 账号 手机号
      NickName: model.userName.value, // 姓名
      HeadPortrait: model.avar.value, // 头像
      SmsCode: model.sms.value, // 短信验证码
      ProvinceId: model.area.ProvinceId, // 省份
      ProvinceName: model.area.ProvinceName,
      CityId: model.area.CityId, // 城市
      CityName: model.area.CityName,
      AreaId: model.area.AreaId, // 区县
      AreaName: model.area.AreaName,
      Address: model.address.value, // 详细地址
      FollowQrcode: model.qrCode.value // 微信二维码
    }
  })
}

// 获取会员中心信息
export function GetMemberCenterInfo() {
  return request({
    url: '/Member/GetMemberCenterInfo',
    method: 'post'
  })
}

// 会员退出
export function loginOut() {
  return request({
    url: '/Member/LoginOut',
    method: 'post'
  })
}

// 获取会员状态类型
export function getMemberStatusType() {
  return request({
    url: '/Member/GetMemberStatusType',
    method: 'post'
  })
}

// 获取会员列表
export function getMemberList(data, Status) {
  return request({
    url: '/Member/GetMemberList?Status=' + Status,
    method: 'post',
    data: data
  })
}

// 根据id获取会员信息
export function getMemberInfoById(UserId) {
  return request({
    url: '/Member/GetMemberInfoById?UserId=' + UserId,
    method: 'post'
  })
}

// 获取会员来源列表
export function getFromList() {
  return request({
    url: '/Member/GetFromList',
    method: 'post'
  })
}

// 根据id修改个人信息
export function updateMemberInfoById(model, UserId) {
  return request({
    url: '/Member/UpdateMemberInfoById',
    method: 'post',
    data: {
      UserId: UserId,
      CardNumber: model.carId.value,
      PhoneNumber: model.phone.value,
      Sex: model.sex.value,
      GradeId: model.grade.value,
      TagIds: model.tags.value.join(','),
      JoinSourceId: model.from.value
    }
  })
}

// 审核会员
export function auditMemberStatus(UserId) {
  return request({
    url: '/Member/AuditMemberStatus?UserId=' + UserId,
    method: 'post'
  })
}

// 获取收货地址
export function GetReceivingAddressList(data) {
  return request({
    url: '/Member/GetReceivingAddressList',
    method: 'post',
    data: data
  })
}
// 编辑地址
export function UserAddressAddOrEdit(data) {
  return request({
    url: '/Member/UserAddressAddOrEdit',
    method: 'post',
    data: data
  })
}
// 编辑地址
export function UserAddressDelete(data) {
  return request({
    url: '/Member/UserAddressDelete',
    method: 'post',
    data: data
  })
}
// 识别地址
export function BatchSmartParse(data) {
  return request({
    url: '/Member/BatchSmartParse',
    method: 'post',
    data: data
  })
}
//设为默认地址
export function UserAddressSetDefault(params) {
  return request({
    url: '/Member/UserAddressSetDefault',
    method: 'get',
    params: params
  })
}
// 获取区域控件获取列表
export function GetCountrywideListBySelRegion(params) {
  return request({
    url: '/Member/GetCountrywideListBySelRegion',
    method: 'post',
    params: params
  })
}

export function GetMyInviteUserInfo(data) {
  return request({
    url: '/Member/GetMyInviteUserInfo',
    method: 'post',
    data: data
  })
}

// 修改密码
export function ReSetPwd(params) {
  return request({
    url: '/Member/ReSetPwd',
    method: 'post',
    params: params
  })
}
// 获取验证码
export function SendSmsNoVerifyCode(params) {
  return request({
    url: '/Member/SendSmsNoVerifyCode',
    method: 'post',
    params: params
  })
}

// 获取用户邀请名额
export function GetUserInviteQuotaList(data) {
  return request({
    url: '/Member/GetUserInviteQuotaList',
    method: 'post',
    data: data
  })
}

// 获取用户邀请明细
export function GetUserInviteRecordList(data) {
  return request({
    url: '/Member/GetUserInviteRecordList',
    method: 'post',
    data: data
  })
}

// 获取邀请二维码
export function GetInviteQuotaQRCode(data, path) {
  return request({
    url: '/Member/GetInviteQuotaQRCode' + path,
    method: 'post',
    data: data
  })
}
// 获取邀请二维码
export function GetMemberGradeList(data) {
  return request({
    url: '/Member/GetMemberGradeList',
    method: 'post',
    data: data
  })
}

// 获取本月收益
export function GetMemberMouthPofit(params) {
  return request({
    url: '/Member/GetMemberMouthPofit',
    method: 'post',
    params: params
  })
}

// 获取收益项目
export function GetMemberMouthPofitList(params) {
  return request({
    url: '/Member/GetMemberMouthPofitList',
    method: 'post',
    params: params
  })
}
// 获取会员详情信息
export function GetUserDetail() {
  return request({
    url: '/Member/GetUserDetail',
    method: 'post'
  })
}
// 获取会员保证金
export function GetUerApplyMoney() {
  return request({
    url: '/Member/GetUerApplyMoney',
    method: 'post'
  })
}
// 获取会员余额信息
export function GetUerBalanceByMoneyType(params) {
  return request({
    url: '/Member/GetUerBalanceByMoneyType',
    method: 'post',
    params: params
  })
}
// 获取资金明细
export function GetWholeSaleMoneyList(data) {
  return request({
    url: '/Member/GetWholeSaleMoneyList',
    method: 'post',
    data: data
  })
}
//获取用户降级配置
export function GetUserGradeDemotionSettingList(path) {
  return request({
    url: '/Member/GetUserGradeDemotionSettingList' + path,
    method: 'post'
  })
}
//获取用户降级配置数据
export function GetUserGradeDemotionData(path) {
  return request({
    url: '/Member/GetUserGradeDemotionData' + path,
    method: 'post'
  })
}
export function AddOrEditUserCarList(data) {
  return request({
    url: '/Member/AddOrEditUserCarList',
    method: 'post',
    data
  })
}

//添加临时购物车
export function AddOrEditUserTempCarList(data) {
  return request({
    url: '/Member/AddOrEditUserTempCarList',
    method: 'post',
    data
  })
}
export function GetUpgradeGradeLink(path) {
  return request({
    url: '/Member/GetUpgradeGradeLink' + path,
    method: 'post'
  })
}
//添加购物车(购物车)
export function AddOrEditStoreUserCarList(data) {
  return request({
    url: '/Member/AddOrEditStoreUserCarList',
    method: 'post',
    data
  })
}
//批量删除购物车商品(扫码点餐)
export function DeleteStoreUserCar(path) {
  return request({
    url: '/Member/DeleteStoreUserCar',
    method: 'post',
    path: path
  })
}
//获取用户购物车(扫码点餐)
export function GetStoreUserCarList(data) {
  return request({
    url: '/Member/GetStoreUserCarList',
    method: 'post',
    data
  })
}
export function OpenAccountFuiou(data) {
  return request({
    url: '/Member/OpenAccountFuiou',
    method: 'post',
    data
  })
}
export function QueryAccountFuiou(data) {
  return request({
    url: '/Member/QueryAccountFuiou',
    method: 'post',
    data
  })
}
export function GetUserPageFromStore(data) {
  return request({
    url: '/Member/GetUserPageFromStore',
    method: 'post',
    data
  })
}
export function GetUserAddressList(params) {
  return request({
    url: '/Member/GetUserAddressList',
    method: 'get',
    params: params
  })
}
export function GetListNotPage(data) {
  return request({
    url: '/Dictionary/GetListNotPage',
    method: 'post',
    data
  })
}

export function GetAllLabels(data) {
  return request({
    url: '/Member/GetAllLabels',
    method: 'post',
    data
  })
}
export function GetListByStore(params) {
  return request({
    url: '/Employee/GetListByStore',
    method: 'get',
    params: params
  })
}
export function RegisterUserFromStore(data) {
  return request({
    url: '/Member/RegisterUserFromStore',
    method: 'post',
    data
  })
}
export function GetMemberFormId(data) {
  return request({
    url: '/Member/GetMemberFormId',
    method: 'post',
    data
  })
}



